using AiQiuQuan.Sport.Model.Enums;
using System.ComponentModel.DataAnnotations;

namespace AiQiuQuan.Sport.Model.Models
{
    /// <summary>
    /// 修改私教预约状态dto
    /// </summary>
    public class CoacherBookStateUpdateDto : IValidatableObject
    {
        /// <summary>
        /// 业务ID
        /// </summary>
        [Required]
        public Guid BusinessId { get; set; }

        /// <summary>
        /// 1进行中、2已取消、3已结束
        /// </summary>
        [Required]
        [EnumDataType(typeof(CoacherBookStateEnum))]
        public CoacherBookStateEnum State { get; set; }

        /// <summary>
        /// validate
        /// </summary>
        public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
        {
            if (State == CoacherBookStateEnum.Finished || State == CoacherBookStateEnum.Cancel)
            {
                yield return new ValidationResult("预约已结束或已取消");
                yield break;
            }
        }
    }
}
